package com.forekonw.demo10;

/**
 * ==  与 equals 的区别
 *
 * ==应用类型使用==比较的是内存地址
 * equals比较的是内容
 */
public class asd {
    public static void main(String[] args) {
        String s1 = "ahah";
        String s2 = "ahah";
        String s3 = new String("ahah");
        String s4 = new String("ahah");
        String s5 = "ah"+"ah";
        String s6 =  new String("ah")+"ah";

        System.out.println(s1==s2);
        System.out.println(s1.equals(s2));
        System.out.println(s3.equals(s4));
        System.out.println(s1==s3);
        System.out.println(s3==s4);
        System.out.println(s1==s5);
        System.out.println(s1==s6);
    }
}
